{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin static ietf_filters textfilters %}
{% block title %}{{ title }}{% endblock %}
{% block pagehead %}
    <link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block content %}
    {% origin %}
    <h1>{{ title }}</h1>
    {% if state_type.slug == "draft-iesg" %}
        <p>
            <a class="btn btn-primary"
               href="{% static 'ietf/images/iesg-draft-state-diagram.png' %}">View diagram</a>
        </p>
    {% endif %}
    <table class="table table-sm table-striped tablesorter">
        <thead>
            <tr>
                <th scope="col" data-sort="state">State</th>
                <th scope="col" data-sort="description">Description</th>
                {% if has_next_states %}<th scope="col" data-sort="next">Next State</th>{% endif %}
            </tr>
        </thead>
        <tbody>
            {% for state in states %}
                <tr id="{{ state.slug|default:"idexists" }}">
                    <th scope="row">{{ state.name }}</th>
                    <td>{{ state.desc|safe|urlize_ietf_docs|linkify }}</td>
                    {% if has_next_states %}
                        <td>
                            {% for s in state.next_states.all %}
                                {{ s.name }}
                                <br>
                            {% endfor %}
                        </td>
                    {% endif %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
    {% if tags %}
        <h2>Tags</h2>
        <table class="table table-sm table-striped tablesorter">
            <thead>
                <tr>
                    <th scope="col" data-sort="tag">Tag</th>
                    <th scope="col" data-sort="description">Description</th>
                </tr>
            </thead>
            <tbody>
                {% for tag in tags %}
                    <tr id="{{ tag.slug }}">
                        <th scope="row">{{ tag.name }}</th>
                        <td>{{ tag.desc|linebreaksbr }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}
{% endblock %}
{% block js %}
    <script src="{% static "ietf/js/list.js" %}"></script>
{% endblock %}